package com.woniuxy.controller;

import com.woniuxy.annotations.RequirePerm;
import com.woniuxy.entity.utils.ResponseEntity;
import com.woniuxy.service.OrderService;
import com.woniuxy.service.PriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/10/10/0010 17:26
 * @Component: 成都蜗牛学苑
 **/
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderService orderService;
    @Autowired
    PriceService priceService;
    @PostMapping("/{pid}/{num}")
    public ResponseEntity addOrder(@PathVariable Integer pid, @PathVariable Integer num){
       return orderService.addOrder(pid,num);
    }
//    @PostMapping("/{port}")
//    public void listenerProduct(@PathVariable int port){
//        orderService.listener(port);
//    }
    @RequirePerm("order::all")
    @GetMapping("/")
    public ResponseEntity searchPrice(Double floorPrice,Double ceilingPrice){
        return priceService.searchPrice(floorPrice,ceilingPrice);
    }
}
